package com.lunwen.lunwen.services.impl;

import com.lunwen.lunwen.bean.Mubantask;
import com.lunwen.lunwen.mapper.MubantaskMapper;
import com.lunwen.lunwen.services.MubantaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (Mubantask)表服务实现类
 *
 * @author makejava
 * @since 2020-08-05 17:18:00
 */
@Service
public class MubantaskServiceImpl implements MubantaskService {

    @Autowired
    private MubantaskMapper mubantaskMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param mubantaskid 主键
     * @return 实例对象
     */
    @Override
    public Mubantask queryById(Integer mubantaskid) {
        return this.mubantaskMapper.queryById(mubantaskid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Mubantask> queryAllByLimit(int offset, int limit) {
        return this.mubantaskMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param mubantask 实例对象
     * @return 实例对象
     */
    @Override
    public Mubantask insert(Mubantask mubantask) {
        this.mubantaskMapper.insert(mubantask);
        return mubantask;
    }

    /**
     * 修改数据
     *
     * @param mubantask 实例对象
     * @return 实例对象
     */
    @Override
    public Mubantask update(Mubantask mubantask) {
        this.mubantaskMapper.update(mubantask);
        return this.queryById(mubantask.getMubantaskid());
    }

    /**
     * 通过主键删除数据
     *
     * @param mubantaskid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer mubantaskid) {
        return this.mubantaskMapper.deleteById(mubantaskid) > 0;
    }

    @Override
    public List<Mubantask> queryAllBy(Mubantask mubantask) {


        return mubantaskMapper.queryAll(mubantask);
    }

    @Override
    public Mubantask checkBy(Mubantask mubantask) {
        return mubantaskMapper.checkBy(mubantask);
    }
}